package GUI.gameWinOld;

import game.Player;

import java.awt.Dimension;
import java.util.LinkedList;

import javax.swing.JFrame;
import javax.swing.JSplitPane;

@SuppressWarnings("serial")
public abstract class GameWindow extends JFrame {
	protected GamePanel gamePanel;
	protected ScorePanel scorePanel;
	public GameWindow(LinkedList<Player> players) {
		super();
		setTitle("Makao! v1.00");
		setVisible(true);
		setGameScorePanel(players);
		JSplitPane content = new JSplitPane() {
			@Override
			public void setDividerLocation(double proportionalLocation) {
				setDividerLocation(0);
			}
			@Override
			public void setDividerLocation(int location) {
				super.setDividerLocation(getWidth()-250);
			}
			@Override
			public int getDividerLocation() {
				return getWidth()-250;
			}
			@Override
			public int getLastDividerLocation() {
				return getWidth()-250;
			}
		};
		setContentPane(content);
		setMinimumSize(new Dimension(800,600));
		gamePanel.getGameBoard().setFrame(this);
		content.setLeftComponent(gamePanel);
		gamePanel.setPreferredSize(gamePanel.getMinimumSize());
		
		content.setRightComponent(scorePanel);
		content.setEnabled(false);
		content.setDividerSize(1);
		content.setResizeWeight(1);
	}
	public GamePanel getGame(){
		return gamePanel;
	}
	protected abstract void setGameScorePanel(LinkedList<Player> players);
}
